package yt.kpool.adapter;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;

import com.king.base.adapter.ViewHolderRecyclerAdapter;
import com.king.base.adapter.holder.ViewHolder;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import yt.kpool.R;
import yt.kpool.activity.miner.MinerChartActivity;
import yt.kpool.activity.profit.ProfitDetailAc;
import yt.kpool.bean.MinerBean;
import yt.kpool.bean.ProfitBean;
import yt.kpool.bean.ProfitTypeBean;
import yt.kpool.util.TimeUtil;

/**
 * 收益模式
 * @Author:Created by  ygy
 * @time:2019/10/8
 */
public class ProfitTypeListAdapter extends ViewHolderRecyclerAdapter<ProfitTypeBean.DataBean.ProfitTypeBean2> {

    private Context contexts;

    private int pos=-1;
    public ProfitTypeListAdapter(Activity context, List<ProfitTypeBean.DataBean.ProfitTypeBean2> listData) {
        super(context, listData);
        contexts = context;

    }

    @Override
    public View buildConvertView(LayoutInflater layoutInflater, int viewType) {
        return layoutInflater.inflate(R.layout.item_profit_type, null);
    }

    @Override
    public void bindViewDatas(ViewHolder holder, final ProfitTypeBean.DataBean.ProfitTypeBean2 dataBean, final int position) {

        holder.setText(R.id.tv_type,"收益模式："+dataBean.getName());
        holder.setText(R.id.tv_num,"利润："+dataBean.getProfit());
        if (pos==position){
            holder.getView(R.id.iv_true).setVisibility(View.VISIBLE);

        }else {
            holder.getView(R.id.iv_true).setVisibility(View.INVISIBLE);
        }

        holder.getConvertView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                pos=position;
                notifyDataSetChanged();
            }
        });

    }

    public int getPos() {
        return pos;
    }

    public void setPos(int pos) {
        this.pos = pos;
    }
}
